Arduino How to simplify your code